#include "cc_msg.h"
#include "cc_mqtt.h"
#include "cc_shell.h"

// 这两个要开就要一起打开
#if (CC_CONFIG_TEST_MSG == 1)
int msg_test_handle(cc_mnode_t data_node)
{
  cc_msg_frame* frame = (cc_msg_frame*)data_node->mem;
  char* data = frame->data;
  cc_log("recv:%s\r\n", data);
  cc_msg_resp(frame->node, data, 0, 0);
  return 1;
}
// CC_MSG_HANDLE_REGISTER(msg_test_handle, "test");

void msg_test_handle(char* param1, int node)
{
  char* msg = (char*)cc_malloc(20);
  memcpy(msg, "test hello", 20);
  cc_msg_send(CC_MSG_SERIAL_NODE, msg, 20, CC_NULL, 0);
  cc_msg_resp(node, "success", 0, 0);
  if (msg != CC_NULL)
  {
    cc_free(msg);
    msg = CC_NULL;
  }
}
// CC_COMMAND_SHELL(msg_test_handle, "test cc_msg_send");

#endif